/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package football;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Herbert
 */
@Entity
@Table(name = "GAMES")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Games.findAll", query = "SELECT g FROM Games g"),
    @NamedQuery(name = "Games.findByIdGames", query = "SELECT g FROM Games g WHERE g.idGames = :idGames"),
    @NamedQuery(name = "Games.findByTermin", query = "SELECT g FROM Games g WHERE g.termin = :termin"),
    @NamedQuery(name = "Games.findByGegner", query = "SELECT g FROM Games g WHERE g.gegner = :gegner"),
    @NamedQuery(name = "Games.findBySpielart", query = "SELECT g FROM Games g WHERE g.spielart = :spielart")})
public class Games implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_GAMES")
    private Integer idGames;
    @Column(name = "TERMIN")
    @Temporal(TemporalType.DATE)
    private Date termin;
    @Size(max = 200)
    @Column(name = "GEGNER")
    private String gegner;
    @Size(max = 200)
    @Column(name = "SPIELART")
    private String spielart;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "games")
    private Collection<Ticket> ticketCollection;

    public Games() {
    }

    public Games(Integer idGames) {
        this.idGames = idGames;
    }

    public Integer getIdGames() {
        return idGames;
    }

    public void setIdGames(Integer idGames) {
        this.idGames = idGames;
    }

    public Date getTermin() {
        return termin;
    }

    public void setTermin(Date termin) {
        this.termin = termin;
    }

    public String getGegner() {
        return gegner;
    }

    public void setGegner(String gegner) {
        this.gegner = gegner;
    }

    public String getSpielart() {
        return spielart;
    }

    public void setSpielart(String spielart) {
        this.spielart = spielart;
    }

    @XmlTransient
    public Collection<Ticket> getTicketCollection() {
        return ticketCollection;
    }

    public void setTicketCollection(Collection<Ticket> ticketCollection) {
        this.ticketCollection = ticketCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idGames != null ? idGames.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Games)) {
            return false;
        }
        Games other = (Games) object;
        if ((this.idGames == null && other.idGames != null) || (this.idGames != null && !this.idGames.equals(other.idGames))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "football.Games[ idGames=" + idGames + " ]";
    }
    
}
